import cv2
import numpy as np

q2 = cv2.imread("../asset/q2.jpeg")
h, w, ch = q2.shape
print(q2.shape)
# 能实现图片倾斜
src = np.float32([[0, 33], [400, 33], [80, 533], [400, 533]])
dst = np.float32([[0, 0], [400, 0], [0, 500], [400, 500]])
M = cv2.getPerspectiveTransform(src, dst)
new_img = cv2.warpPerspective(q2, M, (400, 500))
print(new_img.shape)
while True:
    cv2.imshow('new_img', new_img)
    cv2.imshow('q2', q2)
    key = cv2.waitKey(10)
    if key & 0xFF == ord('q'):
        break

cv2.destroyAllWindows()
